/**
 * webpack.paths
 */

// env
require('./env');

const path = require('path');
const pkgs = require('./package.json');
const getCdnUrl = require('./app/services/get-cdn-url');

const PROJECT_NAME = process.env.PROJECT_NAME || pkgs.projectName || pkgs.name;
const APP_NAME = process.env.APP_NAME || 'www';

// base config
const srcBasePath = path.join(__dirname, 'views');
const distBasePath = path.join(__dirname, 'dist-views');

module.exports = function({
    appName = APP_NAME
}) {
    const distPath = path.join(distBasePath, appName);
    const srcPath = path.join(srcBasePath, appName);
    const assetsPath = `${PROJECT_NAME}/${appName}`;

    return {
        APP_NAME: appName,
        PROJECT_NAME: PROJECT_NAME,
        MANIFEST: path.join(distPath, 'manifest.json'),
        VENDOR_DLL: path.join(distPath, 'dll-map.json'),
        PUBLIC: getCdnUrl(appName),
        ASSETS_PATH: assetsPath,
        DIST: distPath,
        SRC: srcPath
    };
};
